<h3>Structure de contenu</h3>
<div>
	<form method="post">
		<table id="struc-row1">
			<tbody>
				<tr>
					<td>label</td>
					<td><input name="contentobject_structure[contentobject_structure_label]" type="text" /></td>
				</tr>
				<tr>
					<td>caption</td>
					<td><input name="contentobject_structure[contentobject_structure_caption]" type="text" /></td>
				</tr>
			</tbody>
		</table>
	
		<table id="struc-row2">
			<thead>
				<th>position</th>
				<th>label</th>
				<th>caption</th>
				<th>type</th>
				<th>action</th>
			</thead>
			
			<tbody>
				<tr>
					<td><input name="contentobject_structure[elems][0][contentobject_structure_position]" type="text" /></td>
					<td><input name="contentobject_structure[elems][0][contentobject_structure_label]" type="text" /></td>
					<td><input name="contentobject_structure[elems][0][contentobject_structure_caption]" type="text" /></td>
					<td>
						<select name="contentobject_structure[elems][0][contentobject_structure_type]">
							<option value="1" label="Texte Monoligne">Texte Monoligne</option>
							<option value="2" label="Texte Multiligne">Texte Multiligne</option>
							<option value="6" label="Date">Date</option>
							<option value="3" label="Media">Media</option>
							<option value="7" label="checkbox">checkbox</option>
							<option value="8" label="Select">Select</option>
						</select>
					</td>
					<td></td>
				</tr>
			</tbody>
		</table>
		
		<div><a class="btn-ajouter" href="#">+ ajouter</a></div>
		<div><input value="enregistrer" type="submit" /></div>
	</form>
</div>


<script>
$('.btn-ajouter').live("click", function(){
	var uniqueID = new Date();
	var id_number =  uniqueID.getTime();

	var html='<tr>'+
		'<td><input name="contentobject_structure[elems]['+id_number+'][contentobject_structure_position]" type="text" /></td>'+
		'<td><input name="contentobject_structure[elems]['+id_number+'][contentobject_structure_label]" type="text" /></td>'+
		'<td><input name="contentobject_structure[elems]['+id_number+'][contentobject_structure_caption]" type="text" /></td>'+
		'<td>'+
			'<select name="contentobject_structure[elems]['+id_number+'][contentobject_structure_type]">'+
				'<option value="1" label="Texte Monoligne">Texte Monoligne</option>'+
				'<option value="2" label="Texte Multiligne">Texte Multiligne</option>'+
				'<option value="6" label="Date">Date</option>'+
				'<option value="3" label="Media">Media</option>'+
				'<option value="7" label="checkbox">checkbox</option>'+
				'<option value="8" label="Select">Select</option>'+
			'</select>'+
		'</td>'+
		'<td><input class="btn-supprimer" value="supprimer" name="btn-supprimer" type="button" /></td>'+
	'</tr>';

	$('table#struc-row2 tbody').append(html);
	
});

$('.btn-supprimer').live("click", function(){
	$(this).parent().parent().remove();
});

</script>